/// <license>
/// Copyright (c) 2002-2008, DotNetNuke Corporation
/// All rights reserved
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
/// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
/// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
/// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
/// of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
/// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
/// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
/// DEALINGS IN THE SOFTWARE.
/// </license>

#region Using Statements

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.UI.WebControls;

using DotNetNuke.ModuleToolkit.Common;
using DotNetNuke.ModuleToolkit.Modules.Commands;
using DotNetNuke.ModuleToolkit.Modules.Skinning;
using System.Collections.Specialized;
using DotNetNuke.ModuleToolkit.Framework;

#endregion

namespace DotNetNuke.ModuleToolkit.Modules.Skinning.SkinObjects
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The EditorBase skin object is a base Property Editor
    /// </summary>
    /// <history>
    /// 	[cnurse]	04/17/2006	created
    /// </history>
    /// -----------------------------------------------------------------------------
    public class EditorBase : 
        PropertyEditorControl, 
        ISkinObject,
        IModuleCommand,
        IPostBackDataHandler,
        IPostBackEventHandler
    {

        #region Private Fields

        private string _CancelButtonCaption = "Return";
        private string _CancelButtonKey = "Return";
        private string _DeleteButtonCaption = "Delete";
        private string _DeleteButtonConfirmText = "Are You Sure You Wish To Delete This Item?";
        private string _DeleteButtonConfirmKey = "DeleteConfirm";
        private string _DeleteButtonKey = "Delete";
        private string _PublishButtonCaption = "Publish";
        private string _PublishButtonKey = "Publish";
        private string _RejectButtonCaption = "Reject";
        private string _RejectButtonKey = "Reject";
        private string _RestoreButtonCaption = "Restore";
        private string _RestoreButtonKey = "Restore";
        private string _SaveButtonCaption = "Save";
        private string _SaveButtonKey = "Save";
        private string _SubmitButtonCaption = "Submit";
        private string _SubmitButtonKey = "Submit";

        private string _Comment = Null.NullString;

        private bool _DisplayDelete = true;
        private bool _DisplaySave = true;
        private bool _ShowCancel = true;
        private bool _ShowDeleteConfirm = true;

        private Style _ButtonStyle;
        private Style _CancelButtonStyle;
        private Style _CommentStyle;
        private Style _DeleteButtonStyle;
        private Style _PublishButtonStyle;
        private Style _RejectButtonStyle;
        private Style _RestoreButtonStyle;
        private Style _SaveButtonStyle;
        private Style _SubmitButtonStyle;

        private SaveAction _SaveAction = SaveAction.View;

        private SkinnedControl _ParentControl;
        private SkinnablePortalModuleBase _ParentModule;

        private static readonly object EventCommand = new object();

        #endregion

        #region Protected Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the editor type
        /// </summary>
        /// <remarks>Note to Inheritors: You must provide an EditorType for your sub-class.
        /// </remarks>
        /// <history>
        /// 	[cnurse]	10/26/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual string EditorType 
            {
                get { return Null.NullString; }
            }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the module is in Add Mode
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/06/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected bool IsAddMode
        {
            get
            {
                bool isAddMode = false;

                if (ParentModule != null && (ParentModule.IsAddMode))
                    isAddMode = true;

                return isAddMode;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the module is in Edit Mode
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/06/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected bool IsEditMode
        {
            get
            {
                bool isEditMode = false;

                if (ParentModule != null && (ParentModule.IsEditMode))
                    isEditMode = true;

                return isEditMode;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Delete button is displayed
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/10/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowDelete
        {
            get
            {
                bool showDelete = false;
                if (DesignMode)
                    showDelete = true;
                else if (IsAddMode)
                    showDelete = false;
                else if (VersionedEntity != null && !VersionedEntity.IsDeleted)
                    showDelete = DisplayDelete;
                return showDelete;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Publish button is displayed
        /// </summary>
        /// <history>
        ///     [cnurse]  09/09/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowPublish
        {
            get
            {
                bool showPublish = Null.NullBoolean;
                if (DesignMode)
                    showPublish = true;
                else
                {
                    //Entity Moderators have permission to Publish entities
                    if (ParentModule.HasModeratePermission && UseModeration)
                        showPublish = true;
                }
                return showPublish;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Reject button is displayed
        /// </summary>
        /// <history>
        ///     [cnurse]  09/09/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowReject
        {
            get
            {
                bool showReject = Null.NullBoolean;
                if (DesignMode)
                    showReject = true;
                else
                {
                    if (UseModeration && VersionedEntity != null)
                    {
                        //Entity Moderators have permission to Reject entities
                        if (ParentModule != null && ParentModule.HasModeratePermission && VersionedEntity.Status == PublishedStatus.Submitted)
                            showReject = true;
                    }
                }
                return showReject;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Restore button is displayed
        /// </summary>
        /// <history>
        ///     [cnurse]  11/01/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowRestore
        {
            get
            {
                bool showRestore = Null.NullBoolean;
                if (DesignMode)
                    showRestore = true;
                else if (IsAddMode)
                    showRestore = false;
                else if (VersionedEntity != null && VersionedEntity.IsDeleted)
                    showRestore = DisplayDelete;
                return showRestore;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Delete button is displayed
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/10/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowSave
        {
            get 
            {
                bool showSave = false;
                if (DesignMode)
                    showSave = true;
                else if (VersionedEntity != null && !VersionedEntity.IsDeleted)
                    showSave = DisplaySave;
                else if (DataSource != null)
                    showSave = DisplaySave;
                return showSave;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether the Submit button is displayed
        /// </summary>
        /// <history>
        ///     [cnurse]  09/09/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool ShowSubmit
        {
            get 
            { 
                bool showSubmit = Null.NullBoolean;
                if (DesignMode)
                    showSubmit = true;
                else
                {
                    if (UseModeration && VersionedEntity != null)
                    {
                        //Entity Creators have permission to Submit entities
                        if (ParentModule != null && ParentModule.HasCreatePermission && VersionedEntity.Status != PublishedStatus.Submitted && !VersionedEntity.IsDeleted)
                            showSubmit = true;
                    }
                }
                return showSubmit;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets whether Moderation is enabled
        /// </summary>
        /// <history>
        ///     [cnurse]  10/10/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual bool UseModeration
        {
            get { return Null.NullBoolean; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the Data Source being edited as IVersionable
        /// </summary>
        /// <history>
        ///     [cnurse]  10/27/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected IVersionable VersionedEntity
        {
            get { return DataSource as IVersionable; }
        }

        #endregion

        #region Public Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Cancel button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Return"),
        Description("The cancel button Caption.")]
        public string CancelButtonCaption
        {
            get { return _CancelButtonCaption; }
            set { _CancelButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Cancel Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Return"),
        Description("The Resource Key to use to localize the Cancel Button")]
        public string CancelButtonKey
        {
            get { return _CancelButtonKey; }
            set { _CancelButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Comment text
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/2762007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public string Comment
        {
            get { return _Comment; }
            set { _Comment = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Delete button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Delete"),
        Description("The delete button Caption.")]
        public string DeleteButtonCaption
        {
            get { return _DeleteButtonCaption; }
            set { _DeleteButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The resource key to be used for the Delete Button Confirmation popup.
        /// </summary>
        /// <history>
        /// 	[cnurse]	07/19/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("DeleteConfirm"),
        Description("The delete button Confirmation resource key.")]
        public string DeleteButtonConfirmKey
        {
            get { return _DeleteButtonConfirmKey; }
            set { _DeleteButtonConfirmKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text to be used for the Delete Button Confirmation popup.
        /// </summary>
        /// <history>
        /// 	[cnurse]	07/19/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Are You Sure You Wish To Delete This Item?"),
        Description("The delete button Confirmation text.")]
        public string DeleteButtonConfirmText
        {
            get { return _DeleteButtonConfirmText; }
            set { _DeleteButtonConfirmText = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Delete Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Delete"),
        Description("The Resource Key to use to localize the Delete Button")]
        public string DeleteButtonKey
        {
            get { return _DeleteButtonKey; }
            set { _DeleteButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A flag that indicates whether the editor has a delete Command Button.
        /// </summary>
        /// <remarks>This property could be overridden by Business Logic in the inherited 
        /// class.</remarks>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(true),
        Description("Optionally display a Delete Command Button to users with Edit permissions.")]
        public bool DisplayDelete
        {
            get { return _DisplayDelete; }
            set { _DisplayDelete = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A flag that indicates whether the editor has a save Command Button.
        /// </summary>
        /// <remarks>This property could be overridden by Business Logic in the inherited 
        /// class.</remarks>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(true),
        Description("Optionally display a Save Command Button to users with Edit permissions.")]
        public bool DisplaySave
        {
            get { return _DisplaySave; }
            set { _DisplaySave = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Provides a reference to the module that this object is contained in
        /// </summary>
        /// <remarks>
        /// This property is null if the control is not sited on a SkinnablePortalModuleBase control
        /// </remarks>
        /// <history>
        ///   [cnurse]  05/20/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Browsable(false)]
        public SkinnablePortalModuleBase ParentModule
        {
            get
            {
                if (_ParentModule == null)
                    _ParentModule = ControlUtils.FindParent<SkinnablePortalModuleBase>(this);
                return _ParentModule;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Publish button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Publish"),
        Description("The Publish button Caption.")]
        public string PublishButtonCaption
        {
            get { return _PublishButtonCaption; }
            set { _PublishButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Publish Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Publish"),
        Description("The Resource Key to use to localize the Publish Button")]
        public string PublishButtonKey
        {
            get { return _PublishButtonKey; }
            set { _PublishButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Reject button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Reject"),
        Description("The Reject button Caption.")]
        public string RejectButtonCaption
        {
            get { return _RejectButtonCaption; }
            set { _RejectButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Reject Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Reject"),
        Description("The Resource Key to use to localize the Reject Button")]
        public string RejectButtonKey
        {
            get { return _RejectButtonKey; }
            set { _RejectButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Restore button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	11/01/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Restore"),
        Description("The Restore button Caption.")]
        public string RestoreButtonCaption
        {
            get { return _RestoreButtonCaption; }
            set { _RestoreButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Restore Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	11/01/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Restore"),
        Description("The Resource Key to use to localize the Restore Button")]
        public string RestoreButtonKey
        {
            get { return _RestoreButtonKey; }
            set { _RestoreButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Save Action
        /// </summary>
        /// <history>
        /// 	[cnurse]	08/07/2006	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue(SaveAction.View),
        Description("The save action for this editor.")]
        public SaveAction SaveAction
        {
            get { return _SaveAction; }
            set { _SaveAction = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Save button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Save"),
        Description("The save button Caption.")]
        public string SaveButtonCaption
        {
            get { return _SaveButtonCaption; }
            set { _SaveButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Save Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Save"),
        Description("The Resource Key to use to localize the Save Button")]
        public string SaveButtonKey
        {
            get { return _SaveButtonKey; }
            set { _SaveButtonKey = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A flag that indicates whether the editor has a delete Command Button.
        /// </summary>
        /// <history>
        /// 	[cnurse]	07/19/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(true),
        Description("Optionally display a confirmation pop-up for the Delete Command Button to users with Edit permissions.")]
        public bool ShowDeleteConfirm
        {
            get { return _ShowDeleteConfirm; }
            set { _ShowDeleteConfirm = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A flag that indicates whether the editor has a cancel Command Button.
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(true),
        Description("Optionally display a Cancel Command Button to users with Edit permissions.")]
        public bool ShowCancel
        {
            get { return _ShowCancel; }
            set { _ShowCancel = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The text of the Submit button (to be used if no resource key is specified)
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Appearance"),
        DefaultValue("Submit"),
        Description("The submit button Caption.")]
        public string SubmitButtonCaption
        {
            get { return _SubmitButtonCaption; }
            set { _SubmitButtonCaption = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// A String that contains the localization resource key for the Submit Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Localization"),
        DefaultValue("Submit"),
        Description("The Resource Key to use to localize the Submit Button")]
        public string SubmitButtonKey
        {
            get { return _SubmitButtonKey; }
            set { _SubmitButtonKey = value; }
        }

        #region Style Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Cancel Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Default Style to apply to a CommandButton.")]
        public Style ButtonStyle
        {
            get
            {
                if (_ButtonStyle == null)
                    _ButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_ButtonStyle).TrackViewState();
                }
                return _ButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Cancel Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Cancel Button.")]
        public Style CancelButtonStyle
        {
            get
            {
                if (_CancelButtonStyle == null)
                    _CancelButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_CancelButtonStyle).TrackViewState();
                }
                return _CancelButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Comment Box
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Comment Box.")]
        public Style CommentStyle
        {
            get
            {
                if (_CommentStyle == null)
                    _CommentStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_CommentStyle).TrackViewState();
                }
                return _CommentStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Delete Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/20/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Delete Button.")]
        public Style DeleteButtonStyle
        {
            get
            {
                if (_DeleteButtonStyle == null)
                    _DeleteButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_DeleteButtonStyle).TrackViewState();
                }
                return _DeleteButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Publish Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Publish Button.")]
        public Style PublishButtonStyle
        {
            get
            {
                if (_PublishButtonStyle == null)
                    _PublishButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_PublishButtonStyle).TrackViewState();
                }
                return _PublishButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Reject Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Reject Button.")]
        public Style RejectButtonStyle
        {
            get
            {
                if (_RejectButtonStyle == null)
                    _RejectButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_RejectButtonStyle).TrackViewState();
                }
                return _RejectButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Restore Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	11/01/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Restore Button.")]
        public Style RestoreButtonStyle
        {
            get
            {
                if (_RestoreButtonStyle == null)
                    _RestoreButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_RestoreButtonStyle).TrackViewState();
                }
                return _RestoreButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Save Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/20/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Save Button.")]
        public Style SaveButtonStyle
        {
            get
            {
                if (_SaveButtonStyle == null)
                    _SaveButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_SaveButtonStyle).TrackViewState();
                }
                return _SaveButtonStyle;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Style to apply to the Submit Button
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Style"),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true),
        TypeConverter(typeof(ExpandableObjectConverter)),
        Description("The Style to apply to the Submit Button.")]
        public Style SubmitButtonStyle
        {
            get
            {
                if (_SubmitButtonStyle == null)
                    _SubmitButtonStyle = new Style();
                if (IsTrackingViewState)
                {
                    ((IStateManager)_SubmitButtonStyle).TrackViewState();
                }
                return _SubmitButtonStyle;
            }
        }

        #endregion

        #endregion

        #region Protected Methods

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Creates the child control tree
        /// </summary>
        /// <history>
        /// 	[cnurse]	04/20/2006	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// CreateEditor creates the PropertyEditor
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	10/26/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void CreateEditor()
        {
            base.CreateEditor();

            foreach (FieldEditorControl editor in Fields)
            {
                if ((editor.Editor.Name == "Status" || editor.Editor.Name == "VersionNo") && !UseModeration)
                {
                    editor.Visible = false;
                }

                //A bug in the base PropertyEditorControl where AutoGenerate=false
                //means that the LocalResourceFile is not set for the "Fields" and
                //their EditControl children
                editor.LocalResourceFile = LocalResourceFile;
                editor.Editor.LocalResourceFile = LocalResourceFile;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes the specified string.
        /// </summary>
        /// <param name="key">The resource key to localize</param>
        /// <returns>The localized string</returns>
        /// <history>
        /// 	[anurse]	08/11/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected string LocalizeString(string key)
        {
            return LocalizeString(key, key, false);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes the specified string using the <see cref="Localization"/> service.
        /// Returning the specified value if the key could not be localized
        /// </summary>
        /// <param name="key">The resource key to localize</param>
        /// <param name="defaultValue">The default value to return if localization fails</param>
        /// <returns>The localized string or the value of <paramref name="defaultValue"/> if localization fails</returns>
        /// <history>
        /// 	[anurse]	08/11/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected string LocalizeString(string key, string defaultValue)
        {
            return LocalizeString(key, defaultValue, false);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Localizes the specified string using the <see cref="Localization"/> service.
        /// Returning the specified value if the key could not be localized
        /// </summary>
        /// <param name="key">The resource key to localize</param>
        /// <param name="defaultValue">The default value to return if localization fails</param>
        /// <param name="useGlobalResources">A boolean specifying if global or local resources are to be used</param>
        /// <returns>The localized string or the value of <paramref name="defaultValue"/> if localization fails</returns>
        /// <history>
        /// 	[anurse]	08/11/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected string LocalizeString(string key, string defaultValue, bool useGlobalResources)
        {
            string localizedString = defaultValue;
            if (this.ParentModule != null)
                localizedString = this.ParentModule.LocalizeString(key, defaultValue, useGlobalResources);

            return localizedString;
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnPreRender runs just before the control is rendered
        /// </summary>
        /// <param name="e">An EventArgs object</param>
        /// <history>
        /// 	[cnurse]	10/26/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Page.RegisterRequiresPostBack(this);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Render renders the control
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter writer)
        {
            //Render Custom Header
            RenderCustomHeader(writer);

            //Render the Property Editor
            base.Render(writer);

            //Render a Break
            writer.WriteBreak();

            //Render Custom Footer
            RenderCustomFooter(writer);

            //Render the Command row
            if ((ShowDelete || ShowSave || ShowSubmit || ShowReject || ShowPublish || ShowRestore))
            {
                //Render the div tag
                writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                writer.AddStyleAttribute(HtmlTextWriterStyle.MarginTop, "5px");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                //Render the restore Button
                RenderRestoreButton(writer);

                //Render the save Button
                RenderSaveButton(writer);

                RenderCustomButtons(writer);

                //Render the delete Button
                RenderDeleteButton(writer);

                //Render the cancel Button
                RenderCancelButton(writer);

                //Render end of div
                writer.RenderEndTag();
            }

        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderButton renders a CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <param name="includeBreak">A flag that determines whether a break tag is rendered
        /// before the button is rendered.</param>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderButton(HtmlTextWriter writer, string id, string text, string command, string href, string imageUrl, string onClick, bool causesValidation)
        {
            //Render Hyperlink
            if (!string.IsNullOrEmpty(onClick))
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
            if (!string.IsNullOrEmpty(command))
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink(this, command, causesValidation));
            if (!string.IsNullOrEmpty(href))
                writer.AddAttribute(HtmlTextWriterAttribute.Href, href);
            if (!string.IsNullOrEmpty(id))
                writer.AddAttribute(HtmlTextWriterAttribute.Id, id);
            writer.AddAttribute(HtmlTextWriterAttribute.Title, text);
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            //Render Image
            if (!string.IsNullOrEmpty(imageUrl))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveClientUrl(imageUrl));
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);

                //Render end of Image
                writer.RenderEndTag();
            }

            //Render Hyperlink Text
            writer.Write(text);

            //Render end of Hyperlink
            writer.RenderEndTag();
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderButtonStyle renders the buttons style attributes
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <param name="buttonStyle">The style of the specific button</param>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderButtonStyle(HtmlTextWriter writer, Style buttonStyle)
        {
            Style style = new Style();
            if (ButtonStyle != null)
                style.MergeWith(ButtonStyle);
            if (buttonStyle != null)
                style.MergeWith(buttonStyle);
            style.AddAttributesToRender(writer);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderCancelButton renders a Cancel CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderCancelButton(HtmlTextWriter writer)
        {
            bool showCancel = false;
            if (DesignMode)
                showCancel = true;
            else
                showCancel = ShowCancel;

            if (showCancel)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(CancelButtonKey) || DesignMode)
                    buttonText = CancelButtonCaption;
                else
                    buttonText = LocalizeString(CancelButtonKey);

                //Render Style
                RenderButtonStyle(writer, CancelButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Cancel, "", Constants.IMAGE_Cancel, String.Empty, false);
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderCustomButtons renders custom buttons
        /// </summary>
        /// <remarks>This method can be overridden by inheritors to render custom buttons.</remarks>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderCustomButtons(HtmlTextWriter writer)
        {
            //Render the submit Button
            RenderSubmitButton(writer);

            //Render the reject Button
            RenderRejectButton(writer);

            //Render the publish Button
            RenderPublishButton(writer);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderCustomHeader renders  a custom header for the editor
        /// </summary>
        /// <remarks>This method can be overridden by inheritors to render custom content in the header.</remarks>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderCustomHeader(HtmlTextWriter writer)
        {
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderCustomFooter renders  a custom footer for the editor
        /// </summary>
        /// <remarks>This method can be overridden by inheritors to render custom content in the footer.</remarks>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/07/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderCustomFooter(HtmlTextWriter writer)
        {
            if (UseModeration)
            {
                //Render div container
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Width.ToString());
                writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (LabelStyle != null)
                    LabelStyle.AddAttributesToRender(writer);

                //Render the Label
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(LocalizeString(Constants.KEY_Comment));
                writer.RenderEndTag();

                //Render a Break
                writer.WriteBreak();

                if (CommentStyle != null)
                    CommentStyle.AddAttributesToRender(writer);

                //Render the Comment box
                writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID + "_Comment");
                writer.RenderBeginTag(HtmlTextWriterTag.Textarea);
                writer.Write(Comment);
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderDeleteButton renders a Delete CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderDeleteButton(HtmlTextWriter writer)
        {
            if (ShowDelete)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(DeleteButtonKey) || DesignMode)
                    buttonText = DeleteButtonCaption;
                else
                    buttonText = LocalizeString(DeleteButtonKey);

                //Render Style
                RenderButtonStyle(writer, DeleteButtonStyle);

                string confirmText = Null.NullString;
                if (_ShowDeleteConfirm)
                {
                    if (String.IsNullOrEmpty(DeleteButtonConfirmKey) || DesignMode)
                        confirmText = DeleteButtonConfirmText;
                    else
                        confirmText = LocalizeString(DeleteButtonConfirmKey);

                    confirmText = String.Format(Constants.JS_Confirm, confirmText);
                }

                RenderButton(writer, "", buttonText, Constants.CMD_Delete, "", Constants.IMAGE_Delete, confirmText, false);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderPublishButton renders a Publish CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderPublishButton(HtmlTextWriter writer)
        {
            if (ShowPublish)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(PublishButtonKey) || DesignMode)
                    buttonText = PublishButtonCaption;
                else
                    buttonText = LocalizeString(PublishButtonKey);

                //Render Style
                RenderButtonStyle(writer, PublishButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Publish, "", Constants.IMAGE_Publish, "", true);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderRejectButton renders a Reject CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderRejectButton(HtmlTextWriter writer)
        {
            if (ShowReject)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(RejectButtonKey) || DesignMode)
                    buttonText = RejectButtonCaption;
                else
                    buttonText = LocalizeString(RejectButtonKey);

                //Render Style
                RenderButtonStyle(writer, RejectButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Reject, "", Constants.IMAGE_Reject, "", true);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderRestoreButton renders a Restore CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	11/01/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderRestoreButton(HtmlTextWriter writer)
        {
            if (ShowRestore)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(RestoreButtonKey) || DesignMode)
                    buttonText = RestoreButtonCaption;
                else
                    buttonText = LocalizeString(RestoreButtonKey);

                //Render Style
                RenderButtonStyle(writer, RestoreButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Restore, "", Constants.IMAGE_Restore, "", true);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderSaveButton renders a Save CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderSaveButton(HtmlTextWriter writer)
        {
            if (ShowSave)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(SaveButtonKey) || DesignMode)
                    buttonText = SaveButtonCaption;
                else
                    buttonText = LocalizeString(SaveButtonKey);

                //Render Style
                RenderButtonStyle(writer, SaveButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Save, "", Constants.IMAGE_Save, "", true);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderSubmitButton renders a Submit CommandButton
        /// </summary>
        /// <param name="writer">An HtmlTextWriter</param>
        /// <history>
        /// 	[cnurse]	09/09/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual void RenderSubmitButton(HtmlTextWriter writer)
        {
            if (ShowSubmit)
            {
                string buttonText = String.Empty;
                if (String.IsNullOrEmpty(SubmitButtonKey) || DesignMode)
                    buttonText = SubmitButtonCaption;
                else
                    buttonText = LocalizeString(SubmitButtonKey);

                //Render Style
                RenderButtonStyle(writer, SubmitButtonStyle);

                RenderButton(writer, "", buttonText, Constants.CMD_Submit, "", Constants.IMAGE_Submit, "", true);

                writer.Write("&nbsp;&nbsp;");
            }
        }

        #endregion

        #region ISkinObject Implementation

        public SkinnedControl ParentControl
        {
            get
            {
                if (_ParentControl == null)
                    _ParentControl = ControlUtils.FindParent<SkinnedControl>(this);
                return _ParentControl;
            }
        }

        #endregion

        #region IModuleCommand Implementation

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Adds and removes a ModuleCommand Event Handler
        /// </summary>
        /// <history>
        ///     [cnurse]  07/21/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Category("Action"),
        Description("Raised when a command button is clicked")]
        public event ModuleCommandEventHandler ModuleCommand
        {
            add { Events.AddHandler(EventCommand, value); }
            remove { Events.RemoveHandler(EventCommand, value); }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnCommand raises a Command Event
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="e">A CommandEventArgs object</param>
        /// <history>
        /// 	[cnurse]	07/21/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void OnModuleCommand(ModuleCommandEventArgs e)
        {
            ModuleCommandEventHandler commandHandler = (ModuleCommandEventHandler)Events[EventCommand];
            if (commandHandler != null)
                commandHandler(this, e);
        }

        #endregion

        #region IPostBackEventHandler Members

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RaisePostBackEvent runs when a Module CommandButton is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	04/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void RaisePostBackEvent(string eventArgument)
        {
            switch (eventArgument)
            {
                case Constants.CMD_Cancel:
                    OnModuleCommand(new ModuleCommandEventArgs(eventArgument, EditorType, null, Comment));
                    break;
                case Constants.CMD_Delete:
                    OnModuleCommand(new ModuleCommandEventArgs(eventArgument, EditorType, null, Comment));
                    break;
                default:
                    if (DataSource != null)
                    {
                        OnModuleCommand(new ModuleCommandEventArgs(eventArgument, EditorType, DataSource, Comment));
                    }
                    break;
            }
        }

        #endregion

        #region IPostBackDataHandler Members

        public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            Comment = postCollection[postDataKey + "_Comment"];

            return false;
        }

        public void RaisePostDataChangedEvent()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
